#include <iostream>
#include <cstring>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <error.h>
#include <fcntl.h>

const char* path = "./myfifo";

int main()
{
    int fd = open(path, O_RDONLY);
    if(fd < 0)
    {
        perror("open");
        return 2;
    }

    char rev[1024] = {0};
    int n = read(fd, rev, sizeof(rev));

    rev[n] = 0;
    std::cout << rev << std::endl;
}
   